﻿<phone:PhoneApplicationPage 
    x:Class="Portfel.MojePapiery"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
    xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:telerikPrimitives="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Primitives"
	xmlns:viewModels="clr-namespace:Portfel.ViewModels"
    xmlns:telerikData="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Data"
    xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit"
    xmlns:telerikInput="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Input"
    d:DataContext="{d:DesignData SampleData/MainAktywaViewModelSampleData.xaml}"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    SupportedOrientations="Portrait" Orientation="Portrait"
    mc:Ignorable="d" d:DesignHeight="728" d:DesignWidth="480"
    shell:SystemTray.IsVisible="False">
    <toolkit:TransitionService.NavigationInTransition>
        <toolkit:NavigationInTransition>
            <toolkit:NavigationInTransition.Backward>
                <toolkit:SlideTransition Mode="SlideRightFadeIn"/>
            </toolkit:NavigationInTransition.Backward>
            <toolkit:NavigationInTransition.Forward>
                <toolkit:SlideTransition Mode="SlideLeftFadeIn"/>
            </toolkit:NavigationInTransition.Forward>
        </toolkit:NavigationInTransition>
    </toolkit:TransitionService.NavigationInTransition>
    <toolkit:TransitionService.NavigationOutTransition>
        <toolkit:NavigationOutTransition>
            <toolkit:NavigationOutTransition.Backward>
                <toolkit:SlideTransition Mode="SlideRightFadeOut"/>
            </toolkit:NavigationOutTransition.Backward>
            <toolkit:NavigationOutTransition.Forward>
                <toolkit:SlideTransition Mode="SlideLeftFadeOut"/>
            </toolkit:NavigationOutTransition.Forward>
        </toolkit:NavigationOutTransition>
    </toolkit:TransitionService.NavigationOutTransition>
    <UserControl.DataContext>
        <viewModels:MainAktywaViewModel/>
    </UserControl.DataContext>

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <Grid.Resources>
            <Style x:Key="DataBoundListBoxCheckBoxStyle" TargetType="telerikPrimitives:ItemCheckBox">
                <Setter Property="VerticalAlignment" Value="Center"/>
            </Style>
            <DataTemplate x:Key="GroupHeaderTemplate">
                <StackPanel Height="90">
                    <Border  Width="300"  Height="50" HorizontalAlignment="Left" VerticalAlignment="Center" Background="{StaticResource PhoneAccentBrush}">
                        <TextBlock FontSize="{StaticResource PhoneFontSizeLarge}"  Text="{Binding}" Foreground="White"  HorizontalAlignment="Center" VerticalAlignment="Center" Margin="2" />
                    </Border>
                </StackPanel>
            </DataTemplate>
            <DataTemplate x:Key="DataBoundListBoxItemTemplate">
                <Grid Margin="0,0,0,12">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="150"/>
                        <ColumnDefinition/>
                        <ColumnDefinition/>
                        <ColumnDefinition Width="Auto"/>
                    </Grid.ColumnDefinitions>

                    <TextBlock Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="{StaticResource PhoneFontSizeLarge}" FontFamily="{StaticResource PhoneFontFamilySemiLight}" Text="{Binding Title}" TextWrapping="Wrap"/>
                    <StackPanel Grid.Column="1">
                        <TextBlock VerticalAlignment="Center" HorizontalAlignment="Center"  FontSize="{StaticResource PhoneFontSizeSmall}" Text="ilość : " TextAlignment="Center"/>

                        <TextBox BorderThickness="0" VerticalAlignment="Center" HorizontalAlignment="Center" HorizontalContentAlignment="Center" IsEnabled="{Binding IsEditable}"  Text="{Binding Ilość, Mode=TwoWay}" />
                    </StackPanel>
                    <TextBlock Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="{StaticResource PhoneFontSizeLarge}" FontFamily="{StaticResource PhoneFontFamilySemiLight}" Text="{Binding Wartość}" TextWrapping="Wrap"/>
                    <StackPanel Grid.Column="3"  Width="85" Height="85" Background="{Binding Color}" VerticalAlignment="Center" HorizontalAlignment="Center" >
                        <TextBlock Margin="0,0,10,0" VerticalAlignment="Center" HorizontalAlignment="Center" FontSize="{StaticResource PhoneFontSizeSmall}" FontFamily="{StaticResource PhoneFontFamilyNormal}" Text="{Binding Zmiana}" Foreground="White" TextWrapping="NoWrap"/>
                        <TextBlock Margin="0,0,10,0" VerticalAlignment="Center" HorizontalAlignment="Center"  FontSize="{StaticResource PhoneFontSizeSmall}" FontFamily="{StaticResource PhoneFontFamilyNormal}" Text="{Binding ZmianaProcent}" Foreground="White" TextWrapping="NoWrap"/>
                    </StackPanel>
                </Grid>

            </DataTemplate>
        </Grid.Resources>

        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>

        <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28">
            <TextBlock x:Name="ApplicationTitle" Text="portfel" Style="{StaticResource PhoneTextNormalStyle}"/>
            <TextBlock x:Name="PageTitle" Text="moje aktywa" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition/>
                </Grid.ColumnDefinitions>
                <TextBlock Padding="0,0,20,00" FontWeight="Black" TextAlignment="Right" Text="wartość : "/>
                <TextBlock Padding="20,0" Grid.Column="1" Text="{Binding Wartość}"/>
            </Grid>

        </StackPanel>

        <Grid Grid.Row="1">

            <telerikData:RadJumpList x:Name="AktywaList"
                          GroupDescriptorsSource="{Binding GroupDescriptors}"
                               GroupPickerItemsSource="{Binding GroupPicker}"
                                             GroupPickerItemTap="GroupPickerItemTap"
                                             GroupHeaderTemplate="{StaticResource GroupHeaderTemplate}"
                                                        Margin="-12,6,12,0"
                                                        ItemsSource="{Binding Items}" 
                                                        IsCheckModeEnabled="True"
                                                        CheckBoxStyle="{StaticResource DataBoundListBoxCheckBoxStyle}"
                                                        ItemTemplate="{StaticResource DataBoundListBoxItemTemplate}">
                <telerikData:RadJumpList.GroupPickerItemsPanel>
                    <ItemsPanelTemplate>
                        <telerikPrimitives:RadWrapPanel Margin="12,12,12,12" ItemWidth="250" ItemHeight="104" />
                    </ItemsPanelTemplate>
                </telerikData:RadJumpList.GroupPickerItemsPanel>
            </telerikData:RadJumpList>
        </Grid>
    </Grid>

    <phone:PhoneApplicationPage.ApplicationBar>
        <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
            <shell:ApplicationBarIconButton IconUri="/Images/Select.png" Click="ApplicationBarIconButton_Click" Text="wybierz"/>
            <shell:ApplicationBarIconButton IconUri="/Images/Save.png" Click="SaveButtonClick" Text="zapisz"/>
            <shell:ApplicationBarIconButton IconUri="/Images/Data-Edit.png" Click="EditClick" Text="eytuj"/>
            <shell:ApplicationBarIconButton IconUri="/Images/Garbage-Closed.png" Click="UsunClick" Text="usun"/>
            <!--<shell:ApplicationBar.MenuItems>
                <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
                <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
            </shell:ApplicationBar.MenuItems>-->
        </shell:ApplicationBar>
    </phone:PhoneApplicationPage.ApplicationBar>

</phone:PhoneApplicationPage>